package com.shop.utils;

import lombok.Data;

@Data
public class ResultUtils {
    private  Integer code;
    private  String message;
    private  Object object;

    /**
     * 查询，新增成功
     * @return ResultUtils
     */
    public static ResultUtils ok(){
        ResultUtils resultUtils=new ResultUtils();
        resultUtils.setCode(200);
        resultUtils.setMessage("成功");
        return  resultUtils;
    }


    /**
     * 查询，新增成功
     * @return ResultUtils
     */
    public static ResultUtils ok(Object object){
        ResultUtils resultUtils=new ResultUtils();
        resultUtils.setCode(200);
        resultUtils.setObject(object);
        return  resultUtils;
    }
    /**
     * 错误返回编码
     * @param message
     * @param message
     * @return ResultUtils
     */
    public static ResultUtils error(Integer code,String message){
        ResultUtils resultUtils=new ResultUtils();
        resultUtils.setCode(code);
        resultUtils.setObject(message);
        return  resultUtils;
    }

}
